<?php
class M_list_saran extends arfaModel{
	
	function __construct() 
	{
        parent::__construct();
		$this->table_name	= "list_saran";
		$this->primary_key	= "KD_LIST_SARAN";
		$this->order_by		= "KD_LIST_SARAN ASC";
    }
	
	function get_data(){
		$query = $this->db->query("
		SELECT
		list_saran.KD_LIST_SARAN,
		list_saran.NAMA,
		list_saran.NO_TELEPON,
		list_saran.EMAIL,
		list_saran.ISI,
		list_saran.MEDIA,
		list_saran.KD_IJIN,
		list_saran.NO_UPTSA,
		list_saran.TANGGAL,
		list_saran.KATEGORI_S,
		master_ijin.ID_IJIN,
		master_ijin.NAMA_IJIN
		FROM list_saran
		LEFT JOIN master_ijin master_ijin ON list_saran.KD_IJIN = master_ijin.ID_IJIN
		ORDER BY list_saran.KD_LIST_SARAN DESC
		");
		
		return $query->result_array();
	}

	function get_tanggal($get_taw,$get_tak)
	{
		$query = $this->db->query("
			SELECT 
			list_saran.KD_LIST_SARAN,
			list_saran.NAMA,
			list_saran.NO_TELEPON,
			list_saran.EMAIL,
			list_saran.ISI,
			list_saran.MEDIA,
			list_saran.KD_IJIN,
			list_saran.NO_UPTSA,
			list_saran.TANGGAL,
			list_saran.KATEGORI_S,
			master_ijin.ID_IJIN,
			master_ijin.NAMA_IJIN
			FROM list_saran
			LEFT JOIN master_ijin master_ijin ON list_saran.KD_IJIN = master_ijin.ID_IJIN
			WHERE list_saran.TANGGAL BETWEEN '".$get_taw."' AND '".$get_tak."'
		");
		
		return $query->result_array();
	}
	
	function get_tanggal_ikm($get_taw,$get_tak)
	{
		$query = $this->db->query("
			SELECT
			kuesioner_kritik_saran.kd_kuesioner_kritik_saran,
			kuesioner_kritik_saran.kd_kuesioner,
			kuesioner_kritik_saran.kd_modul,
			kuesioner_kritik_saran.kritik_saran,
			kuesioner.kd_kuesioner,
			kuesioner.TGL_KUESIONER
			FROM kuesioner_kritik_saran
			LEFT JOIN kuesioner kuesioner ON kuesioner_kritik_saran.kd_kuesioner = kuesioner.kd_kuesioner
			WHERE kuesioner.TGL_KUESIONER BETWEEN '".$get_taw."' AND '".$get_tak."'
		");
		
		return $query->result_array();
	}
}